<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>基本资料</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="/lib/layuimini2/lib/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="/lib/layuimini2/css/public.css" media="all">
	<style>
		.layui-form-item .layui-input-company {
			width: auto;
			padding-right: 10px;
			line-height: 38px;
		}

		.layui-form .layui-form-label {
			width: 45px;
		}

		.layui-form-select, .layui-form-select input {
			text-align: center;
		}
	</style>
</head>
<body>
<div class="layuimini-container">
	<div class="layuimini-main">

		<div class="layui-form" lay-filter="dataForm">
			<input type="hidden" name="id">
			<input type="hidden" name="status">
			<div class="layui-form-item">
				<label class="layui-form-label">姓名</label>
				<div class="layui-input-block">
					<input type="text" name="name" placeholder="请输入姓名" value="" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">性别</label>
				<div class="layui-input-block" style="width: 100px">
					<select name="sex">
						<option value="1">男</option>
						<option value="0">女</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">微信</label>
				<div class="layui-input-block">
					<input type="text" name="weixin" placeholder="请输入微信" value="" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">QQ</label>
				<div class="layui-input-block">
					<input type="number" name="qq" placeholder="请输入QQ" lay-verify="positiveInteger" value=""
					       class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">电话</label>
				<div class="layui-input-block">
					<input type="text" name="phone" lay-verify="telephone" placeholder="请输入电话" value=""
					       class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">邮箱</label>
				<div class="layui-input-block">
					<input type="email" name="email" lay-verify="Email" placeholder="请输入email" value=""
					       class="layui-input">
				</div>
			</div>
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">备注</label>
				<div class="layui-input-block">
					<textarea name="remark" class="layui-textarea" placeholder="请输入备注"></textarea>
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="/lib/layuimini2/lib/layui/layui.js" charset="utf-8"></script>
<script src="/js/common.js" charset="utf-8"></script>
<script src="/lib/layuimini2/js/lay-config.js" charset="utf-8"></script>
<script>
	layui.use(['form', 'miniTab'], function () {
		var form = verifyForm(layui.form),
			layer = layui.layer,
			$ = layui.jquery,
			miniTab = layui.miniTab;

		myAjax($, layer, {
			url: "/getLoginUser",
			type: 'GET',
			dataType: "json",
			success: function (d, s) {
				form.val("dataForm", d.data);
			}
		});

		//监听提交
		form.on('submit(saveBtn)', function (data) {
			myAjax($, layer, {
				url: '/user/update',
				type: 'POST',
				data: data.field,
				dataType: "json",
				success: function (d, s) {
					if (d.code == 1) {
						layer.msg('保存成功', {icon: 1, time: 1500});
						setTimeout(function () {
							miniTab.deleteCurrentByIframe();
						}, 1500);
					}
				}
			});
			return false;
		});

	});
</script>
</body>
</html>